package com.liu;

import com.liu.product.Product;
import com.liu.product.impl.ProductImplA;
import com.liu.product.impl.ProductImplB;

/**
 * 简单工厂
 *
 * @author liubo
 */
public class SimpleFactory {

    public static void main(String[] args) {
        Product obj = makeProduct("白酒");
        if (obj != null) {
            obj.name();
        }
    }

    public static Product makeProduct(String kind) {
        switch (kind) {
            case "白酒":
                return new ProductImplA();
            case "黄酒":
                return new ProductImplB();
            default:
                return null;
        }
    }
}
